package com.shangyueshang.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shangyueshang.model.SysUserRole;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author JokeyFeng
 * @date: 2022/1/3
 * @project: shangyueshang
 * @package: com.shangyueshang.mapper
 * @comment:
 */
@Component
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {

    /**
     * 删除用户角色
     *
     * @param userId
     * @return
     */
    @Delete("delete from sys_user_role where user_id = #{userId}")
    int deleteByUserId(@Param("userId") Long userId);

    /**
     * 查询用户角色
     *
     * @param userId
     * @return
     */
    @Select("select * from sys_user_role where user_id = #{userId}")
    List<SysUserRole> findUserRoles(@Param("userId") Long userId);
}
